package name.jautzy.esi.server.model;


import javax.persistence.Id;

import com.googlecode.objectify.annotation.Entity;

import name.jautzy.esi.client.model.EsiShip;

@Entity
public class FitProxy {
	@Id private Long proxyId = null;
	private String fitId;
	private String name;
	private String shipName;
	private String groupName;
	private String maker;
	private String race;
	private long score = 0;
	private long techLevel = 1;
	private double effectiveHp = 0;
	private double maxDps = 0;
	private boolean pvp = false;
	private boolean pve = false;
	private boolean copy = false;

	
	public FitProxy copyFor(String user) {
		FitProxy proxy = new FitProxy();
		
		proxy.setFitId(fitId);
		proxy.setName(name);
		proxy.setShipName(shipName);
		proxy.setGroupName(groupName);
		proxy.setMaker(user);
		proxy.setRace(race);
		proxy.setScore(0);
		proxy.setCopy(true);
		proxy.setTechLevel(techLevel);
		proxy.setMaxDps(maxDps);
		proxy.setEffectiveHp(effectiveHp);
		proxy.setPve(pve);
		proxy.setPvp(pvp);
		
		return proxy;
	}
	
	public void incScore() {
		score+=1;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setShipName(String shipName) {
		this.shipName = shipName;
	}

	public String getShipName() {
		return shipName;
	}

	public void setRace(String race) {
		this.race = race;
	}

	public String getRace() {
		return race;
	}
	
	public void setMaker(String maker) {
		this.maker = maker;
	}

	public String getMaker() {
		return maker;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public String getGroupName() {
		return groupName;
	}

	public void setFitId(String fitId) {
		this.fitId = fitId;
	}

	public String getFitId() {
		return fitId;
	}

	public void setScore(long score) {
		this.score = score;
	}

	public long getScore() {
		return score;
	}	
	
	public EsiShip getEsiShip() {
		EsiShip esiShip = new EsiShip();
		esiShip.setGroupName(getGroupName());
		esiShip.setNotation(getScore());
		esiShip.setShipTypeName(getShipName());
		esiShip.setShipName(getName());
		esiShip.setId(getFitId());
		esiShip.setEffHp(getEffectiveHp());
		esiShip.setDps(getMaxDps());
		esiShip.setPve(isPve());
		esiShip.setPvp(isPvp());
		esiShip.setEffHp(getEffectiveHp());
		esiShip.setDps(getMaxDps());
		esiShip.setRace(getRace());
		
		esiShip.setTechLevel(techLevel);
		
		return esiShip;
	}

	public void setEffectiveHp(double effectiveHp) {
		this.effectiveHp = effectiveHp;
	}

	public double getEffectiveHp() {
		return effectiveHp;
	}

	public void setMaxDps(double maxDps) {
		this.maxDps = maxDps;
	}

	public double getMaxDps() {
		return maxDps;
	}

	public void setPvp(boolean pvp) {
		this.pvp = pvp;
	}

	public boolean isPvp() {
		return pvp;
	}

	public void setPve(boolean pve) {
		this.pve = pve;
	}

	public boolean isPve() {
		return pve;
	}

	
	public void setTechLevel(long techLevel) {
		this.techLevel = techLevel;
	}

	public long getTechLevel() {
		return techLevel;
	}

	public void setCopy(boolean copy) {
		this.copy = copy;
	}

	public boolean getCopy() {
		return copy;
	}

}
